<?php

namespace App\Http\Controllers;

use Illuminate\Http\Response;

/**
 * Class BaseController
 * @package App\Http\Controllers
 * api基类
 *
 */

class BaseController extends Controller
{
    //生成api方法 统一返回格式
    protected function create($data, $msg = '', $status = 'success', $code = 200): Response
    {
        $result = [
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
            'status' => $status,
        ];

        return response($result, $code);
    }

    public static function getJwtKey()
    {
        return config('app.key');
    }
}
